import 'package:fzcgx_app/ui/home/model/home_order_model.dart';
import 'package:fzcgx_app/ui/my/address/model/address_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/certificates_upload_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/factory_base_info_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/factory_device_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/factory_environment_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/factory_product_category_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/factory_production_capacity_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/factory_quality_model.dart';
import 'package:fzcgx_app/ui/my/factory/model/select_factory_products2_model.dart';
import 'package:fzcgx_app/ui/my/worker/model/worker_base_info_model.dart';
import 'package:fzcgx_app/ui/my/worker/model/worker_certificates_model.dart';
import 'package:fzcgx_app/ui/order/model/order_colour_model.dart';

import 'package:fzcgx_app/ui/order/model/order_detail_model.dart';
import 'package:fzcgx_app/ui/my/worker/model/worker_education_background_model.dart';
import 'package:fzcgx_app/ui/order/model/order_release_model.dart';
import 'package:fzcgx_app/ui/order/model/order_size_model.dart';

class EntityFactory {
  static T generateOBJ<T>(json) {
    if (json == null || json == '') {
      return null;
    } else {
      switch (T.toString()) {
        case 'FactoryBaseInfoModel':
          return FactoryBaseInfoModel.fromJson(json) as T;
        case 'CertificatesUploadModel':
          return CertificatesUploadModel.fromJson(json) as T;
        case 'FactoryProductCategoryModel':
          return FactoryProductCategoryModel.fromJson(json) as T;
        case 'SelectFactoryProducts2Model':
          return SelectFactoryProducts2Model.fromJson(json) as T;
        case 'FactoryDeviceModel':
          return FactoryDeviceModel.fromJson(json) as T;
        case 'FactoryProductionCapacityModel':
          return FactoryProductionCapacityModel.fromJson(json) as T;
        case 'FactoryProductionCapacityOptionsModel':
          return FactoryProductionCapacityOptionsModel.fromJson(json) as T;
        case 'WorkerBaseInfoModel':
          return WorkerBaseInfoModel.fromJson(json) as T;
        case 'FactoryQualityModel':
          return FactoryQualityModel.fromJson(json) as T;
        case 'WorkerCertificatesModel':
          return WorkerCertificatesModel.fromJson(json) as T;
        case 'FactoryEnvironmentModel':
          return FactoryEnvironmentModel.fromJson(json) as T;
        case 'HomeOrderListModel':
          return HomeOrderListModel.fromJson(json) as T;
        case 'OrderDetailModel':
          return OrderDetailModel.fromJson(json) as T;
        case 'AddressModel':
          return AddressModel.fromJson(json) as T;
        case 'WorkerEducationBackgroundModel':
          return WorkerEducationBackgroundModel.fromJson(json) as T;
        case 'OrderColourModel':
          return OrderColourModel.fromJson(json) as T;
        case 'OrderSizeModel':
          return OrderSizeModel.fromJson(json) as T;
         case 'OrderReleaseModel':
          return OrderReleaseModel.fromJson(json) as T;
        default:
          return json as T;
      }
    }
  }
}
